package no.ffi.gismoidm.attrex;

import java.util.Properties;

/**
 *
 * @author anders
 */
public class NameExists extends BooleanOperator {
    private AttributeOperand op1;
    public NameExists(AttributeOperand op1) {
        this.op1 = op1;
    }
    
    public NameExists(String s1) {
        this(new AttributeOperand(s1));
    }

    @Override
    public BooleanValue getBooleanValue(Properties attributes) throws AttributeEvaluationException {
        String s = op1.getStringValue(attributes);
        return new BooleanValue(s!=null);
    }

    @Override
    public String toString() {
        return "exists(" + op1.toString() + ")";
    }
    
}
